package khs.java_nslookup.main.java;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws IOException
    {
        System.out.print("input addr: ");
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String addr = br.readLine();
        
        InetAddress[] inetaddr = InetAddress.getAllByName(addr);
        
        for(int i=0; i<inetaddr.length; i++){
            System.out.println("hostname: " + inetaddr[i].getHostName());
            System.out.println(inetaddr[i].getHostAddress());
        }
    }
}
